<template>
	<view class="box">
		<!-- <uni-popup ref="popup" type="bottom"> -->
		<view class='header'>
			<image :src="z_imgPath + 'shouye/logo.png'"></image>
		</view>
		<view class=' content'>
			<view>申请获取以下权限</view>
			<text>获得您的手机号</text>
		</view>
		<!-- type='primary' -->
		<button class='bottom' withCredentials="true" lang="zh_CN" open-type="getPhoneNumber"
			@getphonenumber="getPhoneNumber">授权手机号</button>
		<view class="quxiao" @click="back()"> 取消 </view>
		<!-- </uni-popup> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				z_imgPath: 'https://qt.yhemall.com/',

			};
		},
		created() { //默认加载
			// this.login();

		},
		methods: {
			back() {
				uni.navigateBack()
			},
			getPhoneNumber(e) {
				// console.log(e)
				let that = this;
				uni.login({
					success(res) {
						// console.log(res)
						uni.checkSession({
							success() {
								that.req({
									url: 'login_bind_mobile',
									data: {
										code: e.detail.code,
										encryptedData: e.detail.encryptedData,
										iv: e.detail.iv,
									},
									success(res) {
										if (res.status == 1) {
											// uni.setStorageSync('token', res.data);
											uni.showToast({
												title: '绑定成功~',
												icon: 'success',
												success() {
													setTimeout(() => {
														uni.navigateBack()
													}, 1000)
												},
											})
										}
									}
								})
							}
						})

					}
				})

			},


		}

	}
</script>

<style>
	/* .box {
		position: fixed;
		bottom: 0;
	} */

	.header {
		margin: 90rpx 0 90rpx 50rpx;
		border-bottom: 1px solid #ccc;
		text-align: center;
		width: 650rpx;
		height: 300rpx;
		line-height: 450rpx;
	}

	.header image {
		width: 200rpx;
		height: 200rpx;
	}

	.content {
		margin-left: 50rpx;
		margin-bottom: 90rpx;
		color: #fff;
	}

	.content text {
		display: block;
		margin-top: 40rpx;
	}

	.bottom {
		border-radius: 80rpx;
		margin: 70rpx 50rpx;
		font-size: 35rpx;
		background: #1aad19;
	}

	button::after {
		border: none;
	}

	button {
		background-color: #1aad19;
		/* padding-left: 0;
		padding-right: 0;
		line-height: inherit;
		border-radius: 0;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center; */
		color: #ffffff;
		font-weight: 600;

	}

	.quxiao {
		border: 1px solid #1aad19;
		width: 650rpx;
		height: 88rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 44rpx;
		color: #ffffff;
		font-weight: 600;
		margin: auto;
		font-size: 35rpx;
	}
</style>
